<template>
  <div id="teamCardList">
    <van-card v-for="team in teamList" :desc="team.description" :thumb="team.avatarUrl" :title="`${team.teamName}`" @click="doTeamIntro(team)">
      <template #bottom>
        <div>
          {{ `队伍人数: ${team.hasJoinNum}/${team.maxNum}` }}
        </div>
        <div v-if="team.expireTime">
          {{ '过期时间 ' + moment(team.expireTime).format('YYYY-MM-DD') }}
        </div>
        <div v-if="team.createTime">
          {{ '创建时间 ' + moment(team.createTime).format('YYYY-MM-DD') }}
        </div>
      </template>

    </van-card>


  </div>
</template>

<script setup lang="ts">
import moment from 'moment'
import { TeamType } from "../models/team";
import { useRouter } from 'vue-router';

interface TeamCardListProps {
  teamList: TeamType[];
}
defineProps<TeamCardListProps>();

const router = useRouter()
/**
 * 点击跳转队伍详情页
 * @param val
 */
const doTeamIntro = (team) => {
  router.push({
    path: '/team/introduce',
    query: {
      id:team.id
    }
  })
}



</script>

<style scoped></style>